﻿<phone:PhoneApplicationPage 
    x:Class="DDU.Curriculum.Views.BooksView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:viewmodel="clr-namespace:DDU.ViewModel;assembly=DDU.ViewModel"
    xmlns:UX="clr-namespace:DDU.UX;assembly=DDU.UX"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="480"
    shell:SystemTray.IsVisible="False" xmlns:my="clr-namespace:DDU.Converters;assembly=DDU.Converters">
    <phone:PhoneApplicationPage.Resources>
        <my:EnumTranslateConverter x:Key="EnumTranslateConverter" />
        <my:StreamToImageConverter x:Key="StreamToImageConverter" />
    </phone:PhoneApplicationPage.Resources>
    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <ImageBrush ImageSource="/Assets/back.png"/>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.DataContext>
            <viewmodel:BooksGroupViewModel/>
        </Grid.DataContext>

        
        
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="{StaticResource IDS_APP_NAME}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock Text="课本" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <UX:UXPathButton Uri="/Views/BookAddView.xaml" 
                         VerticalAlignment="Bottom" 
                         HorizontalAlignment="Right" 
                         Padding="13" 
                         Margin="12,12,24,40" 
                         IconPath="{StaticResource PATH_ICON_CLOSE}" 
                         Angle="45" />

        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <ListBox ItemsSource="{Binding Path=ItemsOfBookGroup}">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <toolkit:WrapPanel></toolkit:WrapPanel>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <toolkit:HubTile Margin="12,12,0,0"
                                         Message="{Binding Semester.Term, Converter={StaticResource EnumTranslateConverter}}"
                                         Title="{Binding Path=Semester.EducationLevel, Converter={StaticResource EnumTranslateConverter}}" 
                                         Source="{Binding Path=Stream, Converter={StaticResource StreamToImageConverter}}" 
                                         Tag="{Binding Path=SemesterGuid}" Tap="HubTile_Tap"/>

                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
    </Grid>
 
    <!--Sample code showing usage of ApplicationBar-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->

</phone:PhoneApplicationPage>
